package TestDemo.example.service.impl;

import TestDemo.example.mapper.OperateLogMapper;
import TestDemo.example.pojo.OperateLog;
import TestDemo.example.pojo.PageResult;
import TestDemo.example.service.LogService;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Slf4j
@Service
public class LogServiceImpl implements LogService {
    @Autowired
    private OperateLogMapper operateLogMapper;
    public PageResult getLogList(Integer page, Integer pageSize) {
        log.info("分页查询日志列表{}————{}",page,pageSize);
        PageHelper.startPage(page, pageSize);
        Page<OperateLog> pageLog = (Page<OperateLog>) operateLogMapper.getPageList(page,pageSize);
        return new PageResult(pageLog.getTotal(), pageLog.getResult());
    }
}
